Skip to content

My additions to library project - Bethel#2

Open
bfkade1 wants to merge 1 commit intoNBHS-STEM:checkout_bookfrom
bfkade1:patch-1
Open

My additions to library project - Bethel#2
bfkade1 wants to merge 1 commit intoNBHS-STEM:checkout_bookfrom
bfkade1:patch-1

Conversation

@bfkade1
Copy link

@bfkade1 bfkade1 commented Dec 11, 2016

No description provided.

# How can we *remove* an item from a dictionary?
# Write code to delete the book keyed by isbn in the space below

if 'isbn' in remove_book:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_book isn't defined within the scope of the function, it's the name of the function.

del remove_book['isbn']
# Now write code that saves the new version of the data to your library
with open("replayScript.json", "w") as jsonFile:
jsonFile.write(json.dumps(data))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation error.

# Now write code that saves the new version of the data to your library
with open("replayScript.json", "w") as jsonFile:
jsonFile.write(json.dumps(data))
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

# Do we need to return anything?
with open(filename) as f:
json.dump({'students':students,'books':books}, f)
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line still here?



f.__setitem__("filename",checked out)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what the magic method, setitem does?

I'm pretty confident you haven't tested this.

# And again save the data here

with open("replayScript.json", "w") as jsonFile:
jsonFile.write(json.dumps(data))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another indentation error, and I think there's a simpler way to accomplish what you're trying to do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants